<template>
  <div class="index">
    <div class="search">
      <div class="bx">
        <input type="text" placeholder="输入商家、商品名称" />
      </div>
      <div class="bg">
        <div class="bgbx">
          <span>500元备用金</span>
        </div>
      </div>
    </div>
    <div class="list">
      <div class="xh">
        <span>猜你喜欢</span>
      </div>
      <div class="px">
        <span v-for="(item, index) in pxArr" :key="index">{{ item }}</span>
      </div>
      <div class="rm">
        <span v-for="(item, index) in rmArr" :key="index">{{ item }}</span>
      </div>
      <div class="shop" v-for="(item, index) in shoplist" :key="index">
        <div class="img">
          <img :src="item.picUrl" alt="" />
        </div>
        <div class="spjs">
          <div class="name">
            <span>{{ item.name }}</span>
          </div>
          <div class="ys">
            <span>{{ item.monthSalesTip }}</span>
          </div>
          <div>
            <span>{{ item.minPriceTip }}</span>
            <span>{{ item.shippingFeeTip }}</span>
            <span>{{ item.deliveryTimeTip }}</span>
            <span>{{ item.distance }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { shop_list } from "../utils/API";
export default {
  data() {
    return {
      current: 0,
      pxArr: ["综合排序", "距离最近", "销量最高", "筛选"],
      rmArr: ["年货节热卖", "津贴联盟", "满减优惠", "品质联盟"],
      shoplist: [],
    };
  },
  mounted() {
    shop_list().then((res) => {
      console.log(res.data);
      this.shoplist = res.data.list;
    });
  },
};
</script>

<style lang="scss" scoped>
.search .bx {
  background: skyblue;
  height: 50px;
  padding: 10px;
  box-sizing: border-box;
}
.search .bx input {
  height: 30px;
  outline: none;
  border: none;
  width: 100%;
  text-align: center;
  border-radius: 50px;
}
.search .bg {
  padding: 10px;
}
.search .bg .bgbx {
  //   border: 1px solid red;
  background: skyblue;
  height: 100px;
  text-align: center;
  line-height: 100px;
  border-radius: 10px;
}
.list {
  padding: 10px;
}
.list .xh {
  font-size: 18px;
  font-weight: bold;
  padding-bottom: 10px;
}
.list .px {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
}
.list .rm {
  padding-bottom: 20px;
  display: flex;
  justify-content: space-between;
}
.list .rm span {
  background: #f5f5f5;
  padding: 5px 10px;
  font-size: 14px;
  border-radius: 5px;
}
.list .shop {
  margin: 10px 0;
  height: 100px;
}
.list .shop .img {
  height: 100px;
  width: 100px;
  float: left;
  margin-right: 10px;
}
.list .shop .img img {
  width: 100%;
}
</style>